package com.wxc.wxcwzq.web.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wxc.wxcwzq.core.entity.Employee;
import com.wxc.wxcwzq.web.entity.SysRoles;
import com.wxc.wxcwzq.web.mapper.SysRolesMapper;

@Service
public class SysRoleService {
	
	@Autowired
	private SysRolesMapper roleMapper;
	
	/**
	 * 返回所有
	 * @param roles
	 * @param pageNum 页码
	 * @param pageSize 每页显示多少条
	 * @return
	 */
	public Page<SysRoles>queryAllRoleInfo(SysRoles roles,Integer pageNum, Integer pageSize){
//		Page<Employee> page = new Page<>();
		PageHelper.startPage(pageNum,pageSize);
		Page<SysRoles> list = roleMapper.queryAllRoleInfo(roles);
		return list;
	}
	
	/**
	 * 根据id查询
	 * @param id
	 * @return
	 */
	public SysRoles getRoleInfo(Long id){
		return roleMapper.selectByPrimaryKey(id);
	}
	/**
	 * 添加
	 * @param roles 
	 * @return
	 */
	public Integer addRoles(SysRoles roles){
		return roleMapper.insertRoles(roles);
	}
	/**
	 * 修改
	 * @param roles
	 * @return
	 */
	public Integer updateRoles(SysRoles roles){
		return roleMapper.updateRoles(roles);
	}
	/**
	 * 逻辑删除
	 * @param id
	 * @return
	 */
	public Integer deleteRoles(Long id){
		return roleMapper.deleteRoleById(id);
	}
	
	
	
}
